package com.tbryant.test.designpattern.zenofdesignpattern.factory.definition;

/**
 * @author TBryant
 * @date 2021/10/18 15:25
 */
public class ProductFactory extends AbstractProductFactory {
    @Override
    public <T extends AbstractProduct> T createProduct(Class<T> clazz) {
        AbstractProduct abstractProduct = null;
        try {
            abstractProduct = (AbstractProduct) Class.forName(clazz.getName()).newInstance();
        } catch (Exception e) {
            // 异常处理
        }
        return (T) abstractProduct;
    }
}
